Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Social Links: Update Placeholder experience when first inserting Social Links #25941

Merged
merged 12 commits into from
Oct 16, 2020

Conversation

mkaz
Copy link
Member

@mkaz mkaz commented Oct 8, 2020

Description

Adds a new placeholder prop to InnerBlocks and BlockList to render in front of the appender if specified and no blocks.

An example component is passed in with the Social Links to display when no links have been added. The template of default links is also removed. Combined this is intended to provide a better experience than the appearing/disappearing links that require to be removed, while still be clearing what is happening.

@jasmussen Can you try this out, I have a temp placeholder there that can use some better style and improvement.

Fixes: #19020
Fixes: #21700

How has this been tested?

  1. Create a block with social links

  2. Apply the change and confirm nothing breaks with existing block.

  3. When adding new social confirm the placeholder shows and not the old default list.

  4. Confirm the placeholder is removed when a new link is added

  5. Confirm the placeholder does not break or effect other InnerBlocks (columns is a good test)

Screenshots

social-link-placeholder

Types of changes

  • Adds placeholder prop to BlockList component, and renders if no blocks
  • Adds placeholder prop to InnerBlock passing forward to BlockList
  • Add example placeholder to Social Links block
  • Remove template constant passed to InnerBlocks so no default icons inserted
  • Do not hide the icons when the block is not selected, this matches the image placeholder experience

Checklist:

  • API documentation update still required.

@mkaz mkaz added the [Block] Social Affects the Social Block - used to display Social Media accounts label Oct 8, 2020
@github-actions
Copy link

github-actions bot commented Oct 8, 2020

Size Change: -2.01 kB (0%)

Total Size: 1.19 MB

Filename Size Change
build/a11y/index.js 1.14 kB +1 B
build/annotations/index.js 3.54 kB -2 B (0%)
build/block-directory/index.js 8.6 kB +50 B (0%)
build/block-editor/index.js 130 kB +1.23 kB (0%)
build/block-editor/style-rtl.css 11 kB +36 B (0%)
build/block-editor/style.css 10.9 kB +36 B (0%)
build/block-library/editor-rtl.css 8.69 kB +41 B (0%)
build/block-library/editor.css 8.69 kB +41 B (0%)
build/block-library/index.js 142 kB -2.7 kB (1%)
build/block-library/style-rtl.css 7.71 kB +55 B (0%)
build/block-library/style.css 7.71 kB +56 B (0%)
build/block-serialization-default-parser/index.js 1.77 kB -3 B (0%)
build/blocks/index.js 47.6 kB +24 B (0%)
build/components/index.js 169 kB +172 B (0%)
build/components/style-rtl.css 15.4 kB -47 B (0%)
build/components/style.css 15.4 kB -46 B (0%)
build/compose/index.js 9.63 kB +200 B (2%)
build/core-data/index.js 12.1 kB +28 B (0%)
build/data-controls/index.js 684 B -1 B
build/data/index.js 8.63 kB +23 B (0%)
build/dom-ready/index.js 569 B +1 B
build/dom/index.js 4.43 kB +2 B (0%)
build/edit-navigation/index.js 10.6 kB -2 B (0%)
build/edit-post/index.js 306 kB +278 B (0%)
build/edit-post/style-rtl.css 6.37 kB +76 B (1%)
build/edit-post/style.css 6.35 kB +74 B (1%)
build/edit-site/index.js 21.6 kB +629 B (2%)
build/edit-site/style-rtl.css 3.8 kB +75 B (1%)
build/edit-site/style.css 3.81 kB +75 B (1%)
build/edit-widgets/index.js 21.6 kB +346 B (1%)
build/edit-widgets/style-rtl.css 3.09 kB +67 B (2%)
build/edit-widgets/style.css 3.09 kB +66 B (2%)
build/editor/editor-styles-rtl.css 480 B -12 B (2%)
build/editor/editor-styles.css 482 B -11 B (2%)
build/editor/index.js 42.6 kB -2.9 kB (6%)
build/editor/style-rtl.css 3.85 kB +4 B (0%)
build/editor/style.css 3.84 kB +2 B (0%)
build/element/index.js 4.45 kB +1 B
build/escape-html/index.js 733 B -1 B
build/format-library/index.js 7.49 kB +1 B
build/html-entities/index.js 622 B +1 B
build/is-shallow-equal/index.js 709 B -1 B
build/list-reusable-blocks/index.js 3.02 kB +1 B
build/media-utils/index.js 5.12 kB +2 B (0%)
build/notices/index.js 1.69 kB +1 B
build/plugins/index.js 2.44 kB +1 B
build/primitives/index.js 1.35 kB +12 B (0%)
build/priority-queue/index.js 789 B -1 B
build/redux-routine/index.js 2.85 kB +3 B (0%)
build/rich-text/index.js 13 kB +5 B (0%)
build/server-side-render/index.js 2.6 kB +1 B
build/shortcode/index.js 1.7 kB -1 B
build/url/index.js 4.07 kB +3 B (0%)
build/viewport/index.js 1.75 kB +1 B
build/warning/index.js 1.13 kB -1 B
ℹ️ View Unchanged
Filename Size Change
build/api-fetch/index.js 3.35 kB 0 B
build/autop/index.js 2.72 kB 0 B
build/blob/index.js 668 B 0 B
build/block-directory/style-rtl.css 943 B 0 B
build/block-directory/style.css 942 B 0 B
build/block-library/theme-rtl.css 741 B 0 B
build/block-library/theme.css 741 B 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/date/index.js 31.9 kB 0 B
build/deprecated/index.js 772 B 0 B
build/edit-navigation/style-rtl.css 868 B 0 B
build/edit-navigation/style.css 871 B 0 B
build/format-library/style-rtl.css 547 B 0 B
build/format-library/style.css 548 B 0 B
build/hooks/index.js 1.74 kB 0 B
build/i18n/index.js 3.54 kB 0 B
build/keyboard-shortcuts/index.js 2.39 kB 0 B
build/keycodes/index.js 1.85 kB 0 B
build/list-reusable-blocks/style-rtl.css 476 B 0 B
build/list-reusable-blocks/style.css 476 B 0 B
build/nux/index.js 3.27 kB 0 B
build/nux/style-rtl.css 671 B 0 B
build/nux/style.css 668 B 0 B
build/reusable-blocks/index.js 3.04 kB 0 B
build/token-list/index.js 1.24 kB 0 B
build/wordcount/index.js 1.17 kB 0 B

compressed-size-action

@mkaz mkaz force-pushed the try/19020-social-placeholder branch from b995cb8 to 74bac8b Compare October 8, 2020 03:54
@jasmussen
Copy link
Contributor

This is what I see:

social

This is a good feature! It can benefit the navigation menu and buttons blocks also.

It definitely needs a different design :D — ideally something that looks like social links. I'll help you with that. But in principle this seems to work well for me.

@jasmussen
Copy link
Contributor

I've had a moment to reflect on this PR, and I think we have to zoom out for a bit.

Right now, when we refer to "Placeholders" in block editor parlance, we think mostly of this:

Screenshot 2020-10-09 at 09 47 50

It's a big white box with text and buttons inside, always 200px tall. But in most cases, this placeholder looks nothing like the end result. The navigation menu is an excellent example of this — if you squint, there's no way to distinguish a nav menu placeholder from an image placeholder, even though they're vastly different. More importantly, the navigation placeholder looks nothing like its own end result.

That's the driving force behind this good rethink by @shaunandrews in #23207 (comment):

91338938-b3c5ed80-e7a3-11ea-80d5-7aabba57a33c

Instead of using a big box, it provides some handy links to quickly complete the setup state for the block, while at the same time looking just a little bit like the end result. We might be able to get even closer, but this is a good step in the right direction.

All of the above was also the driving force behind preinserting a number of icons when you insert it the first time. And in addition to that, to give a feeling of what the end result might look like.

Putting that all together — squint and it looks right, keep it simple, don't be a giant white box — perhaps we could do with something as simple as this?

placeholder

Those colored dots look like the classic social link blobs, but blurred out to indicate they aren't set up. As son as you add a single button, they disappear.

Speaking of, the "add" menu looks like this:

Screenshot 2020-10-09 at 09 54 43

I do love how it shows 6 icons and has a search feature. But we need to update the search icon to be this one:

Screenshot 2020-10-09 at 10 10 34

and is there any way we can customize the defaults showing up there? I think there's some frecency going on here, but amazon and behance really don't deserve to be at the top, they are just riding on alphabetization here.

@jasmussen
Copy link
Contributor

By the way, if you dig the above, I can push the code to make the setup state look like the mockup.

@mkaz
Copy link
Member Author

mkaz commented Oct 9, 2020

@jasmussen I do like the above 👍

As far as the inserter and the icon, it is still using the common InnerBlocks inserter, so it will require further modifications to allow customizing the icon and other aspects (sort order). We can push those forward in other PRs if think it it is the right approach.

mkaz added 2 commits October 9, 2020 08:15
This prevents the icons disappearing when losing focus and the URL is
not set. This causes is a little unexpected and is not how other
placeholders behave, for example the image placeholder still shows
without an image set and the block not selected.
The placeholder prop can hold a component that will show in front of the
appender if specified and there are no blocks in the block list.

Added to help Social Links render a better placeholder experience.
@jasmussen
Copy link
Contributor

Let's feel it, and if the blur doesn't work I'll try one where I recreate 4 dummy icons and make them semi transparent.

mkaz added 3 commits October 9, 2020 08:19
The placeholder prop accepts a component to render if there are no
blocks. The component is shown inline with the appender.

This was added to support a better experience for Social Links
placeholder.
Improve the default experience for social links when no links are
specified. This uses the new placeholder prop in InnerBlocks and
BlockList.
@mkaz mkaz force-pushed the try/19020-social-placeholder branch from 74bac8b to 9312add Compare October 9, 2020 15:36
@mkaz
Copy link
Member Author

mkaz commented Oct 14, 2020

@jasmussen I just pushed up a change using blurred placeholder. Take a look and let me know if that is what you are thinking. Here's it in action:

social-link-placeholder

@mkaz mkaz marked this pull request as ready for review October 14, 2020 15:48
@shaunandrews
Copy link
Contributor

I have a very strong (negative) reaction to the blurred blobs, but its likely just personal preference.

That said, I also have a concern that the blur would look really strange on some site designs with image/color backgrounds; Its also not very representative of the actual output of the rendered block.

@mkaz
Copy link
Member Author

mkaz commented Oct 14, 2020

@shaunandrews Thanks for the thoughts, I'm fine with altering the blur if it doesn't work.

As far as design, this would only ever show in the editor, are you still thinking of design conflicts in that context?

As far as end result, comparing it to other placeholders like image, shortcodes, etc... none of those look like the end published result when they have not been filled with content. The goal with the Social Link placeholder is just to fill the space with something, so it's not just the [+] inserter in that space when no icons have been picked. The current solution uses actual icons that requires removing and confuses people, so trying for something.

Do you think none blurred circles of color/gray would work better?

@jasmussen
Copy link
Contributor

jasmussen commented Oct 14, 2020

Yep, from the blur in #25941 (comment) I thought it was worth trying, because I had this idea that blur might be a way to make skeleton indicators more "real", and potentially use it for placeholders also:

Screenshot 2020-10-14 at 20 14 27

Screenshot 2020-10-14 at 20 10 29

But it isn't working here as I had hoped. I'll push some tweaks to this.

@shaunandrews
Copy link
Contributor

...are you still thinking of design conflicts in that context?

Yes, specifically in the context of the site editor as well as within patterns with background colors or images.

I bet just the plain circle shapes (not blurred) would work just as well, and be more representative of the intended result.

@jasmussen
Copy link
Contributor

I bet just the plain circle shapes (not blurred) would work just as well, and be more representative of the intended result.

Yep, that's the alternative I was going for, possibly semi transparent. I'll also use fb/twitter/insta colors.

@jasmussen
Copy link
Contributor

I pushed some polish. Here's how it looks now:

status

I think this is worth trying! What do you think?

@mkaz
Copy link
Member Author

mkaz commented Oct 15, 2020

This works well for me, definitely an improvement to the overall placeholder experience.
@shaunandrews thoughts?

@shaunandrews
Copy link
Contributor

image

I like it better than the blurring. It's a little strange that clicking on the empty shapes doesn't do anything, but I realize that starts to creep back towards the current behavior.

--

The empty shapes only makes sense if the block is using the pill or circle style; If you set the default to "Logos Only" this'll break:

image

(The placeholder shapes don't change when I choose the "Pill Shape" style, but I figured that's just an implementation detail that hasn't been sorted yet.)

--

Perhaps unrelated to this PR, the focus shapes are really strange and clicking on the "Browse All" button at the bottom of the inserter unselects the block.

@jasmussen
Copy link
Contributor

jasmussen commented Oct 16, 2020

Solid feedback as usual. I tweaked the setup state based on variations. Default:

icons_dots

Icon only:

icons_only

Pills:

icons_pills

@mkaz
Copy link
Member Author

mkaz commented Oct 16, 2020

@jasmussen Works well 👍

@shaunandrews
Copy link
Contributor

👍

@jasmussen jasmussen self-requested a review October 16, 2020 16:06
Copy link
Contributor

@jasmussen jasmussen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Social Affects the Social Block - used to display Social Media accounts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove WordPress icon from default icons list in Social Icons block Iterate on social block placeholder
4 participants